<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>3-复制-克隆节点</title>
	</head>
	<body>
		<button>点击</button>
		<ul>
			<li>百度</li>
			<li>新浪</li>
			<li>阿里</li>
		</ul>
		<script type="text/javascript">
			//node.cloneNode()
			var btn = document.querySelector('button');
			var ulNode = document.querySelector('ul');
			var oneNode = ulNode.children[0];
			btn.onclick = function(){
				//不加true只复制标签不复制内容
				var newNode = oneNode.cloneNode(true);
				ulNode.insertBefore(newNode,oneNode)
			}
		</script>
	</body>
</html>
